import React, { Component } from 'react'
import subject from '../images/home/subject.png'
import './less/Fast.less'
import { FastApi } from '../request/api'
export default class Fast extends Component {
  state = {
    fastArr: []
  }
  render() {
    return (
      <div className='fast'>
        <ul className='fast_list'>
          {
            this.state.fastArr.map((item, index) => {
              return <li key={index}>
                <img src={subject} alt="" />
                <h3>{item.title}</h3>
                <div className='btn'>刷题</div>
              </li>
            })
          }

        </ul>
      </div>
    )
  }
  componentDidMount() {
    let token = localStorage.getItem("x-auth-token")
    if (token) {
      FastApi().then(res => {
        console.log(res);
        if (res.errCode === 0) {
          //  this.state.fastArr=res.data.records
          //   console.log(this.state.fastArr)
          this.setState({
            fastArr: res.data.records
          })
        }
      })
    }
  }
}
